//
//  EditCardCell.m
//  Shengzhuli
//
//  Created by FXGuo on 17/3/21.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "EditCardCell.h"

@interface EditCardCell()

@property (weak, nonatomic) IBOutlet UILabel *titleLab;

@end

@implementation EditCardCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.contentField.userInteractionEnabled = YES;
}

- (void)setTitle:(NSString *)title
{
    _title = title;
    self.titleLab.text = title;
}
- (void)setPlaces:(NSString *)places
{
    _places = places;
    self.contentField.placeholder = places;
}

- (void)setModel:(CardInfoModel *)model
{
    _model = model;
    if ([self.title isEqualToString:@"姓名"]) {
        self.contentField.text = model.name;
    }else if ([self.title isEqualToString:@"手机"]) {
        self.contentField.text = model.cardPhone;
    }else if ([self.title isEqualToString:@"身份"]) {
        self.contentField.text = model.position;
    }else if ([self.title isEqualToString:@"提供资源"]) {
        self.contentField.text = model.proIdNames;
    }else if ([self.title isEqualToString:@"需求资源"]) {
        self.contentField.text = model.demIdNames;
    }else if ([self.title isEqualToString:@"详细地址"]) {
        self.contentField.text = model.detailedAddress;
        
    }else{
        self.contentField.text = model.emailAddress;
    }
}
- (void)setSaveBlock:(void (^)(NSString *))saveBlock {
    if (self.saveBlock) {
        if ([self.contentField.text isEqualToString:@"姓名"]) {
            self.model.name = self.contentField.text;
        }else if ([self.contentField.text isEqualToString:@"手机"]) {
            self.model.cardPhone = self.contentField.text;
        }else if ([self.contentField.text isEqualToString:@"身份"]) {
            self.model.position = self.contentField.text;
        }else if ([self.contentField.text isEqualToString:@"提供资源"]) {
            self.model.proIdNames = self.contentField.text;
        }else if ([self.contentField.text isEqualToString:@"需求资源"]) {
            self.model.demIdNames = self.contentField.text;
        }else if ([self.contentField.text isEqualToString:@"详细地址"]) {
            self.model.detailedAddress = self.contentField.text;
        }else if ([self.title isEqualToString:@"邮箱地址"]) {
            self.model.emailAddress = self.contentField.text;
        }
        self.saveBlock(self.contentField.text);
    }
}


@end
